{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Solution:\n",
    "    def findRelativeRanks(self, nums: [int]) -> [str]:\n",
    "        score = list(set(nums))\n",
    "        score.sort(reverse=True)\n",
    "        \n",
    "        rank_dict = {}\n",
    "        for i in range(len(score)):\n",
    "            if i == 0:\n",
    "                rank_dict[score[i]] = \"Gold Medal\"\n",
    "            elif i == 1:\n",
    "                rank_dict[score[i]] = \"Silver Medal\"\n",
    "            elif i == 2:\n",
    "                rank_dict[score[i]] = \"Bronze Medal\"\n",
    "            else:\n",
    "                rank_dict[score[i]] = str(i+1)\n",
    "        \n",
    "        rank_list = []\n",
    "        for x in nums:\n",
    "            rank_list.append(rank_dict[x])\n",
    "        \n",
    "        return rank_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "s = Solution()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Gold Medal', 'Silver Medal', 'Bronze Medal', '4', '5']"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.findRelativeRanks([5,4,3,2,1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
